package com.yulinlin.jdbc.serialize.impl;

import org.springframework.stereotype.Component;

import java.lang.reflect.Field;
import java.sql.Timestamp;
import java.util.Date;

@Component
public class DateSerialize implements ITypeSerialize<Date, Timestamp> {

    @Override
    public Timestamp serialize(Date o) {
        Timestamp now =  new  Timestamp(o.getTime());
        return  now;
    }


    @Override
    public Date unSerialize(Timestamp o,Field clazz)
    {
        return new Date(o.getTime());
    }
}
